<?php
	include_once 'isLogin.php';
	$table_name = "adv";
	$advc=new adv();
	
	if($_GET['action']=='del'){
		$delFile = array(
			array('key'=>'adv_img','dir'=>'../upload/adv/large/'),
			array('key'=>'adv_img','dir'=>'../upload/adv/small/'),
		);
		echo $commonc->del($table_name,$_POST['id'],$delFile);
		exit();
	}


	//排序
	if($_GET['action']=='sort'){
		if($_POST['type']=='up') $type = "prev";
		if($_POST['type']=='down') $type = "next";
		$sort = $commonc->sortChange($table_name, $_POST['id'], $type);
		echo $sort['id'];
		exit();
	}



	$row=$advc->adv_list($where);

	
	$smarty->assign("row",$row['result']);
	$smarty->assign('page',$row['page']);
	$smarty->display("adv_list.html");
?>